﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace Stationery.UC
{
    public partial class UC_NewsOnScreen : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Params["viewtype"] == null)
            {
                ControlBody.Controls.Add(LoadControl("~/UC/UC_TotalNews.ascx"));                
                //ControlBody.Controls.Add(LoadControl("~/UC/UC_NewsHot.ascx"));                
            }
            else if (Request.Params["viewtype"] == "groupnews")
            {
                int groupid = 0;
                groupid = Convert.ToInt32(Request.Params["gid"]);
                if (groupid == -1)
                    return;// or Invalid page
                else
                {                       
                    ControlBody.Controls.Add(LoadControl("~/UC/UC_GroupNews.ascx"));                    
                }
            }
            else if (Request.Params["viewtype"] == "detail")
            {
                int groupid = 0;
                groupid = Convert.ToInt32(Request.Params["gid"]);
                if (groupid == -1)
                    return;
                int newsid = 0;
                newsid = Convert.ToInt32(Request.Params["newsid"]);
                if (newsid == -1)
                    return;
                                
                ControlBody.Controls.Add(LoadControl("~/UC/UC_NewsDetail.ascx"));                
            }
            else
            {
                return; //or Invalid Page
            }

        }
    }
}